package com.mutual.reins.config.service.impl;

import com.mutual.reins.config.entity.FhTreaty;
import com.mutual.reins.config.mapper.FhTreatyMapper;
import com.mutual.reins.config.service.IFhTreatyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author CodeGenerate
 * @since 2021-04-29
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class FhTreatyServiceImpl extends ServiceImpl<FhTreatyMapper, FhTreaty> implements IFhTreatyService {

    /**
     * 获取Map（key：treatyNo, value:FhTreaty）
     *
     * @return map
     */
    @Override
    public Map<String, FhTreaty> getFhTreatyMap() {
        Map<String, FhTreaty> fhTreatyMap= new HashMap<>(32);
        List<FhTreaty> fhTreatyList = this.list();
        for(FhTreaty fhTreaty:fhTreatyList){
            fhTreatyMap.put(fhTreaty.getTreatyNo(),fhTreaty);
        }
        return fhTreatyMap;
    }
}
